﻿package plugin.simpleChat
{
    import com.core.*;
    import com.sh.game.consts.*;
    import com.sh.game.global.*;
    import flash.utils.*;
    import plugin.simpleChat.game.*;
    import view.*;

    public class SimpleChat extends FlashUIBase
    {
        private var _ui:ChatGame;

        public function SimpleChat()
        {
            return;
        }// end function

        override protected function preLoaderInit() : void
        {
            super.preLoaderInit();
            appendLoader(Config.getUrl("assets/images/mornui/common.swf", ResourceType.NORMAL));
            appendLoader(Config.getUrl("assets/images/mornui/chatHead.swf", ResourceType.NORMAL));
            return;
        }// end function

        override protected function initGUI() : void
        {
            this._ui = new ChatGame(this);
            mGUI = this._ui;
            return;
        }// end function

        override protected function openRefresh() : void
        {
            if (data)
            {
                if (data is Dictionary)
                {
                    this._ui.datas = data;
                }
                else
                {
                    this._ui.data = data;
                }
            }
            ModelProxy.change("data", "isSimpleChatOpen", true);
            this._ui.initEvent();
            return;
        }// end function

        override public function close() : void
        {
            ModelProxy.change("data", "isSimpleChatOpen", false);
            this._ui.removeEvent();
            super.close();
            return;
        }// end function

    }
}
